package cn.com.chengmandian.bike.controller;


import cn.com.chengmandian.bike.model.EbDepositConfig;
import cn.com.chengmandian.bike.service.IEbDepositConfigService;
import cn.com.chengmandian.core.web.pojo.AgentInfo;
import cn.com.chengmandian.core.web.pojo.AjaxResult;
import cn.com.chengmandian.core.web.utils.LocalMapUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 押金规则配置表 前端控制器
 * </p>
 *
 * @author AutoGenerator
 * @since 2021-12-15
 */
@Api(tags = "押金规则相关接口")
@RestController
@RequestMapping("/deposit/config")
public class EbDepositConfigController {

    @Autowired
    private IEbDepositConfigService depositConfigService;

    @ApiOperation("获取押金配置")
    @GetMapping("/get")
    public AjaxResult<EbDepositConfig> get() {
        AgentInfo agentInfo = LocalMapUtil.getAgentInfo();
        Assert.notNull(agentInfo.getAreaId(), "缺少运营区ID");
        return AjaxResult.success(depositConfigService.getConfig(agentInfo.getAreaId()));
    }
}
